var send = new Vue({
	el:"#app",
	data:{
		cardid:'',
		code:''
	},
	//计算属性
	computed: {},
	//监听属性
	watch: {},
	//钩子函数
	created() {
		if (document.URL.indexOf("?") < 0) return; //获取当前url地址,如果没参数.直接返回
		var str = document.URL.split("?")[1];
		var obj = {};
		var arr;
		//当只有一个参数传过来时
		if (str.indexOf("&") < 0) {
			if (str.indexOf("=") < 0) return;
			arr = str.split("=");
			obj[arr[0]] = arr[1];
			this.cardid = obj
			return obj;
		}
	},
	mounted(){
		this.getCashcardDetail()
	},
	methods:{
		getCashcardDetail(){
			var that = this
			s5.initData({url:'/cashcard-send-detail',type:'post',data:{cate_id:this.cardid.cate_id}},(res)=>{
				var data = JSON.parse(res)
				that.code = data.data
				var qrcode = new QRCode(document.getElementById("qrcode"), {
					text: that.code.url,
					width: 128,
					height: 128,
					colorDark : "#000000",
					colorLight : "#ffffff",
					correctLevel : QRCode.CorrectLevel.H
				});
			})
			
		},
		refresh(){
			// $('#qrcode').html('')
			// var that = this
			// s5.initData({url:'/cashcard-send-detail',type:'post',data:{cate_id:this.cardid.cate_id}},(res)=>{
			// 	var data = JSON.parse(res)
			// 	that.code = data.msg
			// 	var qrcode = new QRCode(document.getElementById("qrcode"), {
			// 		text: that.code.url,
			// 		width: 128,
			// 		height: 128,
			// 		colorDark : "#000000",
			// 		colorLight : "#ffffff",
			// 		correctLevel : QRCode.CorrectLevel.H
			// 	});
			// })
			location.reload()
		},
		goSend(){
			window.location.href = "cashcard-send-history.html?cate_id=" +this.code.id
		},
	}
})
